#include "web_acceptor.h"

void handler::web_acceptor::handle_event(boost::shared_ptr<network::event> n)
{
	// creating the receiver and handler...
	boost::shared_ptr<handler::web_handler> h(
		handler::web_handler::create(n->new_sock, _controller));

	boost::shared_ptr<network::parser> pars(
		network::singletone<network::configurator>
			::instance()->get_tcp_parser());

	boost::shared_ptr<network::receiver> recv(
		network::receiver::create(n->new_sock, _queue, pars));
	recv->add_listener(_cont);
	recv->add_listener(h);	// the handler get's notified if receiver dies
	_multi->add_handler(h);

	_cont->add(recv);
	recv->start_thread();
}

